package com.sptpc.exam.controller;


import com.sptpc.exam.model.Student;
import com.sptpc.exam.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;

@RestController
@RequestMapping("/stu")
public class StudentController {

    @Autowired
    private IStudentService service;

    @PostMapping("/add")
    public Student addNewStudent(@RequestBody Student student){

        return service.addNewStudent(student);
    }

    @DeleteMapping("/del/{id}")
    public String deleteStudent(@PathVariable Long id){

        service.deleteStudent(id);
        return "删除成功";
    }
}
